import java.util.Scanner;

public class three {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while (in.hasNextDouble()){
		double a = in.nextDouble();
		int sum = 0,sum1 = 0,sum2 = 0;
		a=Math.abs(a);
		String s = String.valueOf(a);
		String r[] = s.split("\\.");
		for(int i = 0;i<r[0].length();i++){
			String s1 = r[0].substring(i, i+1);
			sum1+=Integer.parseInt(s1);
		}
		for(int j = 0;j<r[1].length();j++){
			String s2 = r[1].substring(j, j+1);
			sum2+=Integer.parseInt(s2);
		}
		sum=sum1+sum2;
		System.out.println(sum);
		
		}

	}

}
